package com.test;

import ma.glasnost.orika.MapperFacade;
import ma.glasnost.orika.MapperFactory;
import ma.glasnost.orika.impl.DefaultMapperFactory;

import java.util.Date;

/**
 * Created by frinder on 2017/5/18.
 */
public class OrikaDemo {


    public static MapperFacade mapperFacade;

    static {
        MapperFactory factory = new DefaultMapperFactory.Builder().build();
        mapperFacade = factory.getMapperFacade();
    }


    public static void main(String[] args) {
        DateConverterDemo.Src src = new DateConverterDemo.Src();
        DateConverterDemo.Dest dest = mapperFacade.map(src, DateConverterDemo.Dest.class);
        System.out.println(dest);
    }


    public static class Src {
        private String date = "2018-01-01 16:40";

        public String getDate() {
            return date;
        }

        public void setDate(String date) {
            this.date = date;
        }
    }


    public static class Dest {
        private Date date;

        public Date getDate() {
            return date;
        }

        public void setDate(Date date) {
            this.date = date;
        }

        @Override
        public String toString() {
            return "Dest{" +
                    "date=" + date +
                    '}';
        }
    }

}
